home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PROGEDIT
/
0773.ZIP
/
SETUT.DOC
< prev
Wrap
Text File
|
1987-12-09
|
37KB
|
1,057 lines
SE ECS Screen Editor
SE ECS Screen Editor
REFERENCE MANUAL and TUTORIAL
CSMAN 87-5 08-Dec-87
SE
ECS Screen Editor
TUTORIAL
(C) 1987 Southampton University, UK. ISBN 0854322884
J. Adrian Pickering,
Department of Electronics and Computer Science,
The University,
Southampton, SO9 5NH
UK 8th December 1987
Tel: +44 (0)703 559122
1
SE ECS Screen Editor
Tutorial
Introduction
One of the interpretations of the acronym 'SE' is 'Simple
Editor'. Though there are quite a number of facilities in
SE, it is still a very easy editor with which to become
familiar. SE is a 'Screen Editor' which presents text on a
screen rather like type on a sheet of paper. Though there
are some similarities between SE and typing onto paper be
careful not to take the analogy too far - SE can do a lot
more than a typewriter and do it a lot easier!
To learn the rudiments of SE using this Tutorial you will
need a computer which can run SE and allow you to create
files in its filestore. The computer's output must appear on
a display screen; SE cannot work with printing terminals.
The Tutorial is written in a general way for all
implementations of SE so you may need some specific extra
help regarding how get your computer to work. Ask a
colleague or consult the local beginners' information for the
computer system for help on how to get started. In addition,
a medium size example text file will be useful, so also ask
for one or permission to access one. (If you have access to
the SE distribution disk then a copy of this Tutorial would
be suitable.)
For those who have met editors before it is worth mentioning
that SE is an editor for program-like texts. It is not a
'word processing' type editor and makes no attempt to massage
the text to fit the available spaces automatically on the
screen. For really good textual output on relatively cheap
computing machinery, then use SE followed by one of the
'post-processing' text formatting programs like 'roff' or
'LaTeX'.
Getting started and finishing
Before starting SE you will be sitting at your computer
display and keyboard with the computer running. The
computer's prompt should be present on the screen, inviting
you to type a command. The objective is to create a 'file'
or document and record it using the computer's file storage
system (for later recall and processing). For the purposes
of this introduction, this file will be called 'myfile'.
Give the computer the following command (type the underlined
parts; the '>' symbol stands for the computer's prompt - it
may be different on your computer):
>se myfile
followed by 'return' and the SE program will start to run.
Briefly it will give a sign-on message something like:
2
SE ECS Screen Editor
Tutorial
ECS Screen Editor, 17-Nov-87. (IBM PC)
telling you that SE, version dated '17-Nov-87' (or whenever),
is starting and configuring itself for an 'IBM PC' (or
whatever). It will then clear the screen and position the
cursor at the top left of the working area just below a
status line saying something like:
[ New file ] INSERTING
(If someone had already left a file around called 'myfile'
then the file would not be new and you would see what is in
it instead.)
Having got SE started, the first thing to find out how to do
is how to leave SE safely. If there is a 'home' key on the
keyboard try hitting this. Alternatively, use the 'end of
file' code or the program abort code for your computer system
(often control+Z or control+C, where this means press the
'control' key AND the letter at the same time). This should
give you the SE command line:
Command: ======================
with the cursor waiting at the prompt. The key (combination)
you pressed is called the command key. From here you can
give SE a wide variety of commands, including those which
enable you to leave SE and get back the the system command
level. At this stage a useful command is the help command
which you can invoke by typing '?' (or 'H', 'h' or 'Help') at
the prompt:
Command: help ======================
followed by 'return'. The display should give you details of
how to use the command line and also how to use the special
keypad or function keys available on your terminal. If no
help information like this appears then SE is not installed
properly on the computer - ask for some human help. (The
Tutorial appendix contains some help data for a few common
versions of SE.)
To leave help and get back to editing just type 'return' on
its own on the command line. Try it and then get the help
display back again. The display shows how to get out without
creating or amending the file 'myfile' using the quit
command:
Command: q ======================
followed by 'return'. SE should finish up by saying:
Aborted, myfile not written.
>
with your system command prompt back again.
3
SE ECS Screen Editor
Tutorial
Being creative
Start SE again using 'myfile'. When the screen display stops
and the cursor shows, type a few words with the keyboard
followed by return. Each 'return' starts a new line; create
a few more similar lines. If you mistype a character then
you can erase it by hitting the delete key and then retyping.
Note that SE's 'delete' key may not be the same as the one
labelled 'delete' on the keyboard; check with the help
display using command h return. 'Delete' backspaces the
cursor by one position each time, deleting as it goes.
Now move the cursor back the the beginning of the first line
of the text you typed in. To do this find the cursor keys on
your keyboard and try pressing these a few times. If these
do not have the desired effect of moving the cursor up, down,
left or right then have a look at the help display again to
see where SE's cursor movement keys are located.
Note that all the time the text was being entered the the
message INSERTING was displayed on the top right hand corner
of the screen. The meaning of this can be shown if you now
type another word or two from where you are at the beginning
of the first line. INSERTING causes the the text that is
already there to move and make space for the new text so it
is not lost or typed over.
Now choose a word somewhere in the middle of the text, move
to it and change it. You will need to use the cursor keys to
position the cursor at the end of the word and the 'delete'
key to do the erase. As you type the new word in room for it
will be made automatically because you are in INSERT mode.
Insert mode also enables to to prise lines apart and insert
new ones using the 'return' key. Position the cursor in the
middle of a word and press 'return'. If you decide that you
did not want the line break there then the two line parts can
be joined again using 'delete'.
Sometimes you want to be able to make corrections by
overtyping. To do this INSERT mode must be switched off so
that the text stays in place as you type. The help
information should show a key labelled insert on/off. Find
this key and press it and the INSERTING message on the status
line at the top of the screen should disappear. Press it
again and the INSERTING message should re-appear. The INSERT
key 'toggles' the INSERT mode with the status line giving a
clear indication of which mode SE is currently in.
Choose a word in the middle of the text and replace it using
overtype mode. If you change it for a word with a different
length then you will also have to use INSERT mode to change
the length of the text to fit it in.
See how the 'delete' and 'return' keys work slightly
differently in insert and overtype modes. The rule is that
the text dimensions must remain the same in overtype mode
4
SE ECS Screen Editor
Tutorial
since it must behave like overtyping on a piece of paper.
When overtyping 'delete' leaves spaces behind as it moves the
cursor backwards. Return just moves to the beginning of the
next line without inserting a new one or breaking a line.
Note that the cursor keys do the same thing irrespective of
what mode you are in.
It can be rather confusing trying to work out in which mode a
particular editing task is best performed. It is a good idea
to stick to one mode as your default. Almost all editing
tasks can be performed in INSERT mode; this also happens to
be SE's default too.
The next move
Position the cursor at the end of your text and then
repeatedly hit the cursor left key. You should observe that
the cursor jumps to the end of the previous line from the
beginning of a line. The command key followed by the left or
right keys get to the beginning or the end of the current
line respectively. The same thing happens in overtype mode.
More rapid movement around the text can be acheived using the
word right and word left keys. Find out which ones these are
from the help display and try them out. Note that a word is
simply a group of characters bounded by spaces so a group
like ' 123 ' is treated as a word.
Getting it together
You have already discovered what happens if you delete past
the beginning of a line in INSERT mode. Effectively, the
'newline' marker between the present line and the previous
one gets deleted and the two lines join together. Remember
that newline can be inserted anywhere along a line, thus
enabling a split of one line into two.
There is another delete key called delete under cursor which
works the same way independent of the current mode. It is
useful for deleting characters from the rest of the line but
without moving the cursor position. This includes the
implicit 'newline' under of the cursor when there are no more
characters on the line, thus joining lines. Try using it
beyond the end of a line and you will see it has a particular
use in joining the next line to the present one at the
specific position of the cursor.
5
SE ECS Screen Editor
Tutorial
Filing it away
To examine some more features of SE you will need the larger
file that was mentioned in the introduction. So you can go
back to your experimental file and play some more, store the
text away by leaving SE in the normal way using the exit
command. This saves the edited text in the file specified
when you started SE.
Command: e ==============|-------
followed by 'return' and your text is now written to the
file:
Written file myfile
>
Your system prompt should be present, awaiting the next
command. You may wish to check the file and its content by
using commands that do 'list directory' and 'show a file on
the display'.
A great mover
Using the borrowed larger text file, invoke SE with its name
first and using a 'scratch' file name second:
>se setut null
This means edit 'setut' into file 'null'. If you do not
supply a second filename SE assumes that you want the newly
edited file to have the same name as the previous version
(which is usual). We do not want another version of 'setut'
to be created in this instance since we are only
experimenting.
You may be wondering by now what the line at the top, right
of the display in command mode is supposed to mean. This is
a bar line display showing roughly where you are in the file.
The line corresponds to the complete text; the thick part is
the proportion that you can see on the display and the
vertical mark indicates where the cursor is.
Examine the file contents by paging through it using the page
down key. Also try using the up and down cursor keys and the
word right and left keys and see what happens when the cursor
reaches the edge of the displayed text. The page display
scrolls as if the cursor is nudging the display window
downwards. Sometimes you want to leave the cursor where it
is on the display but move just the window instead. This is
where the scroll up and scroll down keys are useful. Move
the cursor away from the screen edge and try scrolling.
After trying a few page downs check that the page up key
6
SE ECS Screen Editor
Tutorial
works. Find out what happens when you attempt to page beyond
the end of a file. SE allows you to move past the end, line
by line, so that it can be extended, but not jump over it
into empty space.
If your file is very large then it could become a little
tedious finding the end of the file by repeatedly paging.
The SE command facility can be useful here, so press the
command key. At the command prompt you can type the line
number that you want the cursor to go to. The last line in
the file is probably a number you do not know (and do not
really want to know). Remembering that you cannot jump past
the end of the file, you could just type a very large number
instead. Fortunately SE has a special symbol for such a
number. The . (full stop) stands for a big positive number:
Command: . ---=|-----------------
followed by 'return' should place the cursor at the end of
the file. Since line numbers are often too precise, you can
use approximate line range numbers to jump around the text.
For example:
Command: .5 --------------------==
will get you half way through the file. Numbers like .1 and
.9 get you near the beginning and end of the file
respectively.
When using the command line you can correct mistakes by using
the 'delete' key or, if you want to clear the whole line,
just hit the command key again. When you do this you also
get some different and useful status reports in the right
corner.
Somewhere around here
More often than not you know where you want to be in a file
by reference to a piece of the text, not by its line number.
Indeed, as you edit a file and insert and delete lines, the
line numbers are constantly changing anyway. A more useful
way of positioning is by getting SE to find an instance of a
particular fragment of text by searching for it.
Decide on a word near to the cursor position but ahead of it
and invoke the SE command prompt. Type the word exactly as
you want to SE to find it (the search is letter case
sensitive) and finish with the word right key. This is the
command to scan forwards through the text, from the next
cursor position onwards until the word is found. SE will
reposition the cursor on the first letter of the matched word
and redraw the screen so the cursor line is as near the
centre of the screen as possible. If this is not the
instance of the word that you wanted, invoke the command line
again and hit the word right key again. SE will then find
7
SE ECS Screen Editor
Tutorial
the next instance of the same search word you specified
before. If another one cannot be found then SE will 'beep'
and put a question mark up by the word in the command line.
The cursor position will still be the same as it was before
the search began as shown by the bar line display. You can
confirm this by clearing the command line (hit the command
key) and typing 'return' to get back to the text.
As you might expect, you can search backwards from the
current cursor position as easily as searching forwards by
finishing the search string with the word left key instead of
word right.
Moving up the block
When editing real pieces of text of your own you will need to
know how to make bigger deletions in an easier way than by
using the single character delete key lots of times. SE can
delete text in units of lines with the delete line key. Find
this key and press it a few times to see what happens. (You
do not need to worry about what happens to the file; remember
we are editing into a 'scratch' file which can be deleted if
necessary!) Note that lines disappear, but not irrevocably
(yet) since SE tells you on the status line that it is
holding them. You can find out what this means if you press
the restore key. Provided that you did not reposition the
cursor between pressing the delete line key and the restore
key, the text should now be just like it was before.
The SE status line should say that it is still holding the
lines that you have just restored. Press the restore key
again and another copy of the previously deleted lines will
appear. Note that they reappear in the reverse order that
they were deleted. You could go on replicating as long as
there is space in the SE text buffer to hold all the lines.
You can reposition the cursor anywhere in the file before
pressing restore thus enabling a text block to be moved or
copied. Being able to replicate one or more lines like this
is often quite useful for building up forms, program comment
headers and party invitations.
When you want to change the contents of the holding buffer so
you can fill it with some new lines, the insert key is used.
To dump the held lines press it twice in succession. This
leaves the mode as it was but empties the holding buffer,
indicated by the 'holding' message disappearing. Always
remember to clear the holding buffer this way before
undertaking a new text block copy or move.
If you have a lot of lines to delete it is easy to delete one
or two lines too many. This can be easily put right by using
the undelete key. This takes just one of the deleted lines
and puts it back at the cursor position. Thus the action of
the restore key is slightly different in that it COPIES out
of the held list but undelete one line MOVES lines out of the
8
SE ECS Screen Editor
Tutorial
list.
The limitation of being able to only delete and restore whole
lines is not as restricting as it sounds. It is very easy to
isolate a section from a line by splitting it using
'return's. After deleting the section the remaining bits can
be joined back together again if necessary. Try taking out a
section of a line using this technique and, perhaps, moving
the deleted section into another line somewhere else.
Remember that you must be in insert mode to be able to split
lines.
Lots more times
You have used some keys both when screen editing and within
command mode - 'delete', 'return' and the word left and word
right cursor keys. Most of the other keys do the same in
command mode as they do when screen editing but repeated a
specific number of times. From the SE command line type:
Command: . --------------------|=
followed by the cursor up key. This means go a 'big' number
of lines up from the the current line, which should mean go
to the beginning of the file. From here do the command again
but type the cursor down key instead and you should now be at
the end of the file. Try it out with the page up and down
keys and with smaller numbers. For example to go up 45 lines
type command 45 cursor up; to go down 2 pages (where a page
is a screenful) type command 2 page down.
The repeat factor also applies to the delete line key. But
before you try this it is perhaps worth pointing out that if
you are at the start of the text and do . delete line SE will
do exactly what you ask and delete ALL the lines in the file!
Just delete a few lines. Note that they can be recovered
again using the restore key.
Repeat factors can be signed numbers. Indeed, if you want to
treat 'return' as a cursor movement key instead of the key
you finish SE commands with, you must make the number signed.
Thus another way of moving to the beginning of the file then
you can go a 'big negative' number of 'return's back by
typing:
Command: - ------=|--------------
where - stands for a 'big' negative number and, as 'return'
always goes to the first character in a line, you should now
be at the first character in the file.
To move to the ends of lines or the top or bottom lines on
the screen you can use a 'void' factor, that is not giving
one at all. To move to the current line start use cursor
left from command mode prompt; to move to the line end use
9
SE ECS Screen Editor
Tutorial
cursor right similarly. The cursor up and down keys with
void factors move the cursor to the page top and page bottom
respectively.
In summary, the 'line' affecting keys can take signed repeat
factors on the SE command line. The 'character' (and 'word')
right and left keys take a word matching argument and cause
character scanning through the text until a match is found.
Special meanings are attached to void arguments.
In for major surgery
There are two other screen editing keys that have different
uses in command mode. The undelete key normally recovers the
last search word remembered by SE from the last search (see
the Reference Manual for a complete description). Sometimes
it is useful to check what the last string was before using
it in case there is some doubt. If you want to search for
something almost but not quite the same, recall the string
and edit it before for the next search.
The restore key takes a file name as an argument. This
restores text from another file rather than the holding
buffer. This can be useful for adding standard 'pro forma'
bits of text into a new file, such as a letter or program
heading. You should have a file 'myfile' available for
inclusion in the current file you are editing. Move to
somewhere in the middle of the current text and then give the
command:
Command: myfile --------=|------------
followed by the restore key. With any luck, after a very
short pause, the screen should redraw with the cursor sitting
on the top line of the newly inserted piece of text.
Without moving the cursor from the current position, now give
the command:
Command: - --------|-------------
followed by the delete line key. This means delete all the
lines above the current position (remember what was said
about signed arguments above). Now find the end of the
'myfile' bit of the file and move to the next line beyond it.
Execute the command:
Command: . |==-------------------
followed by the delete line key again. You have now
performed major surgery on the text you had, cutting out
everything except a small section from the middle. This type
of action can be useful for isolating a file fragment for
inclusion (using restore) in a subsequent edit. Obviously,
what you have done here is not so useful - just creating
10
SE ECS Screen Editor
Tutorial
another instance of 'myfile'!
The contents of the holding buffer are not affected when
either the undelete and restore keys are used in command
mode.
Problems, problems
Though every effort is made to ensure that the text display
is a true rendering of what is in the computer memory, this
might not always appear to be so. For instance, a message
from another user or from the system might suddenly appear in
the middle of the text as you are editing it. If you do not
believe the display is correct then you can ask SE to redraw
it all using the verify command:
Command: v =|============--------
followed by 'return'. (Some SEs have a verify key that does
the same thing.)
Another useful command in this family is the 'continue'
command. In a computer system that does not have a good
reliability record then it is wise to periodically ask SE to
write the current state of the text to the file store before
continuing with a long edit. How often you use this depends
on how much you value your time!
If SE runs out of space in the computer to store your text
then it will automatically switch into its browsing mode and
issue a warning message. Browsing is an SE mode that forbids
any changes but allows moving around the text. (SE can be
used as a 'browser' by using the -b option; see below for
more about options.)
Tidying up
The practical part of the tutorial is now complete and you
can now leave SE in the usual way using command e return.
Check to see if the file 'null' was created and delete it if
necessary (on some systems it may not be because 'null' is a
special file that just dumps any data put into it).
Fancy facilities
Because SE is supposed to be 'simple' it does not have many
fancy facilities. However, there are a few areas where SE
can justify some extras.
11
SE ECS Screen Editor
Tutorial
Often you know whereabouts you wish to start editing an
existing text. This might be the end of the text if you are
extending a document or at a specific line number if a
program compiler has told you on which line an error lies.
When starting SE you can give it an optional extra line
number argument. The numbers you give have the same format
as with the SE line number setting command. Here are some
examples:
>se myfile -l . (the end of the file)
>se setut null -l .5 (half way through)
>se myprog.c -l 231
When SE is being used for document production then it is
convenient to be able to 'copy type' the text without being
bothered about having to hit the 'return' key at the end of
every line. SE has a wrap mode which applies to the file
editing session. When used, the first space typed after the
right margin in INSERT mode will cause a new line to be
created automatically. (The right margin is 13 characters in
from the right edge of the display.) The space that causes
the wrap is not inserted in the text. Wrapping only works in
INSERT mode since you might want to perform corrections or
lay out text in a specific way. If so, then switch into
overtype mode and wrapping will not occur. The wrap facility
can be invoked by starting SE with a -w argument:
>se myfile -w
There is another formatting aid useful for programmers.
Correctly indenting program texts is a necessary chore and
SE's auto-indent feature can assist with this. It is invoked
with the 'auto' option:
>se myprog.c -a
When a new line is created SE positions the cursor underneath
the first character of the previous line, if there was one.
If not, then the cursor column position will be the same as
it was before. Again, this only has an affect in INSERT mode
for the same reasons as with wrapping. Since auto-indenting
causes extra spaces to be inserted automatically by SE you
would expect it to automatically take them out again if you
decide to join two lines. SE does what you expect.
If you want to use more than one option at once then all you
have to do is combine them on the command line:
>se myprog.c -a -l 231
(Some versions of SE might have some variations about how to
specify command line options in order to be compatible with
the host computer system standard.)
12
SE ECS Screen Editor
Tutorial
Some experienced users of editors might be wondering where
the 'replace' or 'substitute string' facility is. SE does
not have one! However, what it does have is a more general
purpose ability to remember screen editing key sequences
(sometimes called 'macros' in other editors). This can be
used to memorise the operation required to replace a word.
Thus to find and replace a string in SE (a) find the next
occurrence by searching and the (b) repeat the edit by
replaying the memorised sequence. The memorise facility is
also useful for pulling in or pushing out blocks of program
code.
Quite often, while editing, you need to make quick reference
to some other source of information that is also on the
computer somewhere. It is tedious to have to finish the
edit, look up the information, and then restart the edit
again. Most versions of SE have a shell command (command s
return) which suspends the edit temporarily to enable you to
get the information you want. To go back to the edit, exit
the command shell (typically by issuing the command 'exit')
and SE will reawaken at the point it was left off.
Getting on
You now know about all the important features of SE. The
Appendix contains some quick reference information covering
all the facilities of SE. You may care to glance over this
to get an idea of what other things SE can do.
If you need further information then look in the Reference
Manual. It has a comprehensive index which should enable you
to find the parts relevant to your query. The Reference
Manual also has an advanced examples section which should be
of interest once you are more familiar with SE. Of course,
you can always consult your local expert. However, it
shouldn't take long to become one yourself!
13
SE ECS Screen Editor
Appendix 1 - Typical help pages
.
14
SE ECS Screen Editor
Appendix 2 - Quick Reference
.
15
SE ECS Screen Editor
Appendix 2 - Quick Reference
.
16